{* $Id$ *}
{include_core file="admin/lib/header.html" title="快递展示"}
{if empty($search_filter) && empty($express_list) && $status != 0}
<div class="search-none search-none-bg">
  <p>还没有快递发布，点击<a href="{AnUrl('express/admin/add')}" class="search-none-add">添加快递</a></p>
</div>
{else}
<div class="page-header border-bottom clearfix">
  <h2 class="left">快递管理<span>在这里对快递进行管理</span></h2>
  <a href="{AnUrl('express/admin/add')}" class="btn btn-success btn-sm right"><i class="icon-add"></i>添加快递</a>
</div>
<div class="search-form js_advancedForm">
<form action="express/admin" method="get" class="js_expressSearchForm">
  <input type="hidden" name="status" value="{$status}">
  <p>
    <label for="" class="search-f-label">快递标题：</label>
    <input type="text" class="search-f-ipt1" name="search_filter[title]" value="{$search_filter.title}">
  </p>
  <p><label for="" class="search-f-label"></label><button type="submit" class="btn btn-success btn-xs js_searchBtn">搜索</button></p>
</form>
</div>
<!--start:列表-->
<table class="list-table">
  <caption>按状态：
    <a href='{AnUrl("express/admin?status=1")}' {if $status == 1} class="label label-primary" {else} class="label label-default" {/if}>正常</a>
    <a href='{AnUrl("express/admin?status=0")}' {if $status == 0} class="label label-primary" {else} class="label label-default" {/if}>已删除</a>
  </caption>
  <thead><tr>
    {if $status == 1}
    <th style="width:20px;"><input type="checkbox" class="selectAll"></th>
    {/if}
    <th style="min-width:60px;">快递标题</th>
    <th style="min-width:200px;">描述</th>
    <th style="width:130px;">添加时间</th>
    <th style="width:180px;">操作</th>
  </tr></thead>
  <tbody>
  {foreach $express_list as $k=>$v}
  <tr id="dataList{$v.id}" {if $k%2 == 1} class="bg-gray"{/if} data-id="{$v.id}">
  {if $status == 1}
  <td><input type="checkbox" class="listSelect"></td>
  {/if}
  <td>{$v.title}</td>
  <td>{$v.intro}</td>
  <td>{time_format($v.add_time)}</td>
  <td>
    {if $status == 1}
    <a href="{AnUrl("express/admin/area?express_id={$v.id}")}" class="btn btn-success btn-xs">管理</a>
    <a href="{AnUrl("express/admin/add?express_id={$v.id}")}" class="btn btn-info btn-xs"><i class="icon-edit icon-white"></i>编辑</a>
    <a href="{AnUrl("express/admin/delete?express_id={$v.id}")}" class="btn btn-danger btn-xs deleteOne"><i class="icon-trash icon-white"></i>删除</a>
    {elseif $status == 0}
    <a href="{AnUrl("express/admin/change_status?express_id={$v.id}&status=1")}" class="btn btn-success btn-xs changeStatus"><i class="icon-trash icon-white"></i>恢复</a>
    {/if}
  </td>
  </tr>
  {foreachelse}
  <tr><td class="txtleft" colspan="5">暂无数据</td></tr>
  {/foreach}
  </tbody>
  {if $status == 1}
  <tfoot><tr><td><input type="checkbox" class="selectAll"></td><td colspan="4"><a href="{AnUrl("express/admin/delete")}" class="btn btn-danger btn-xs deleteAll">批量删除</a></td></tr></tfoot>
  {/if}
</table>
{include_core file="admin/lib/pager.html"}
{/if}
<!--end:列表-->
<script>
  $(function(){
    // 高级搜索
    $('.js_advanced').click(function(e){
      e.preventDefault();
      var thisObj = $(this);
      var outBox  = thisObj.closest('form');
      if (thisObj.hasClass('js_isOpen')) {
        thisObj.removeClass('js_isOpen open');
        outBox.find('input').show();
        outBox.find('button').show();
        $('.js_advancedForm').hide();
      } else {
        thisObj.addClass('js_isOpen open');
        outBox.find('input').hide();
        outBox.find('button').hide();
        $('.js_advancedForm').show();
      }
    });

    // 高级搜索时间验证
    $('.js_searchBtn').click(function(e){
      e.preventDefault();
      var thisObj   = $(this);
      var startDate = $.trim($('#startDate').val());
      var stopDate  = $.trim($('#stopDate').val());
      if (startDate > stopDate) {
        showMsg('结束时间应大于等于开始时间');
        return;
      }
      thisObj.closest('form').submit();
    });
  });
</script>
{include_core file="admin/lib/footer.html"}